## About
This is a POSIX compliant shell script for downloading and updating the Firefox user.js from [Privacy-Handbuch](https://www.privacy-handbuch.de/handbuch_21u.htm).

The script will download the user.js of your choice from Privacy-Handbuch into the selected profile directory. It is recommended to close Firefox and Thunderbird before changing their user.js. Changes will take effect at the next start.


## Usage
After downloading `updater` you need to make the script executable first: `chmod +x updater`. You can either run it via `/path/to/updater` or put it in one of your `$PATH` directories to be able to just call `updater` (or whatever file name you have chosen).

If this script is *not* located in your Firefox's user profile directory (which is e. g. `~/.mozilla/firefox/yourprofile.default`) you have to specify your profile directory with `-p PROFILE` or select it via `-l`.

Just like the ghacks user.js updater, this script will search for a `user-overrides.js` in your selected profile directory and append it to the downloaded user.js. The options from `user-overrides.js` will take precedence over those from the user.js.

For automated updating you should at least use the option `-y` so the updater won't hang waiting for your confirmation.
You can also have the updater update itself automatically through the option `-s`. Alternatively, you can let the updater check for updates with `-u`. If there is an update available, the latter will ask whether you want to update so you can check out the changes beforehand. You might run `-u` or `-s` without specifying a valid profile path to just update the updater.

#### Example usage
##### Manual updating:
```
updater -ulc moderat -o "/home/user/.mozilla/firefox/yourprofile.default/overrides.js"
```
This will search for updates of this updater (`-u`), present you a list of Firefox profiles to select one from (`-l`), install the `moderat` version of the user.js (`-c moderat`) and append the given override file to the resulting user.js (`-o "…"`). The last option is needed because the name of the file is not `user-overrides.js`.

##### Automatic updating of Firefox and Thunderbird user.js in one run (e. g. as a cronjob):
```
/path/to/updater -dsyp "/home/user/.mozilla/firefox/yourprofile.default" -p "/home/user/.thunderbird/yourprofile.default"
```
This will create a diff file for later comparison of the current and older versions of the user.js (`-d`), update the updater silently (`-s`), update the user.js without asking for confirmation (`-y`) and operate in the given Firefox profile folder (`-p "…/firefox/…"`) as well as in the given Thunderbird profile folder (`-p "…/.thunderbird/…"`). Since `-c` is not specified, each user.js file will be updated to the current version of their respective config. The `-p` option is needed only if the updater resides in a different directory than your profile.


## Maintenance
Is this software still maintained?

Yes. There's not much to update, that's why the last commit might date back quite a while. Don't worry though, I will be notified of new issues.


## Acknowledgment
This script is based on the [ghacks user.js updater.sh](https://github.com/ghacksuserjs/ghacks-user.js/blob/master/updater.sh). Thanks for all your work!


## License
This software is licensed under the MIT License.
